package com.yonyou.state;
import com.intellij.ide.util.PropertiesComponent;
import com.intellij.openapi.components.Service;

@Service
public final class DataDb {

    private final PropertiesComponent propertiesComponent = PropertiesComponent.getInstance();

    public void save(String key, String value) {
        propertiesComponent.setValue(key, value);
    }

    public void save(String key, Integer value) {
        propertiesComponent.setValue(key, value, 0);
    }

    public void save(String key, Boolean value) {
        propertiesComponent.setValue(key, value);
    }

    public void clear(String key) {
        propertiesComponent.unsetValue(key);
    }

    public String get(String key, String defValue) {
        return propertiesComponent.getValue(key, defValue);
    }

    public int get(String key, int defValue) {
        return propertiesComponent.getInt(key, defValue);
    }

    public boolean get(String key, boolean defValue) {
        return propertiesComponent.getBoolean(key, defValue);
    }

}
